
import 'package:json_annotation/json_annotation.dart';
import 'package:reabampos/src/reabam/operation/bean/base/rb_response.dart';

//定义生成的文件 flutter pub run build_runner build --delete-conflicting-outputs
part 'request_login.g.dart';

@JsonSerializable(explicitToJson: true,includeIfNull: false)
class LoginRequest{

  String? mobile;
  String? loginWord;
  String? appVersion;
  String? clientVersion;
  String? jpushRegId;
  String? appType;
  String? loginType;
  String? groupId;

  LoginRequest(
      this.mobile,
      this.loginWord,
      this.appVersion,
      this.clientVersion,
      this.jpushRegId,
      this.appType,
      this.loginType,
      this.groupId,
      );

  factory LoginRequest.fromJson(Map<String, dynamic> json) => _$LoginRequestFromJson(json);
  Map<String, dynamic> toJson() => _$LoginRequestToJson(this);

}


@JsonSerializable(explicitToJson: true,includeIfNull: false)
class LoginResponse extends RBBaseResponse{

  //旧token
  LoginBean? DataLine;
  //oauth2
  LoginBean? data;

  LoginResponse({this.data,this.DataLine}); //添加固定格式

  factory LoginResponse.fromJson(Map<String, dynamic> json) => _$LoginResponseFromJson(json);
  Map<String, dynamic> toJson() => _$LoginResponseToJson(this);

}

@JsonSerializable(explicitToJson: true,includeIfNull: false)
class LoginBean {

  String? userName;  //用户姓名
  String? userStatus;  //认证状态
  String? tokenId;  //登录TokenID
  String? userCode;  //手机账号  即登录账号
  String? userTypeCode;  //用户类型编码  DianZhu 店主 DianZhang 店长 DaoGou 导购PuTong 普通用户
  String? userType;  //用户类型名称
  String? userTypeName;  //用户类型名称
  String? serverAddress;  //零售,出入库等
  String? zuulServerAddress;//订货模块
  String? companyName;

  String? groupName;
  String? brandLogo;

  String? companyId;
  String? groupId;
  String? fid;
  List<FunConfigsBean>? funConfigs;
  List<FunConfigsBean>? funs;
  List<MenuBean>? menus;

  Bean_login_guide? guideSet;

  int merchantDeposit=0;//商户保证金是否启用  merchantDeposit  1是 0否
  int dealerDeposit=0;//经销商保证金是否启用  dealerDeposit 1是 0否

  LoginBean(
      {
        this.userName,
        this.userStatus,
        this.tokenId,
        this.userCode,
        this.userTypeCode,
        this.userType,
        this.userTypeName,
        this.serverAddress,
        this.zuulServerAddress,
        this.companyName,
        this.groupName,
        this.brandLogo,
        this.companyId,
        this.groupId,
        this.fid,
        this.funConfigs,
        this.funs,
        this.menus,
        this.guideSet,
        this.merchantDeposit=0,
        this.dealerDeposit=0
      }
      );

  factory LoginBean.fromJson(Map<String, dynamic> json) => _$LoginBeanFromJson(json);
  Map<String, dynamic> toJson() => _$LoginBeanToJson(this);

}

@JsonSerializable(explicitToJson: true,includeIfNull: false)
class FunConfigsBean {

  String? funCode;
  String? funName;
  int display=0;
  int isDisplay=0;


  FunConfigsBean({
    this.funCode, this.funName, this.display=0, this.isDisplay=0
  });

  factory FunConfigsBean.fromJson(Map<String, dynamic> json) => _$FunConfigsBeanFromJson(json);
  Map<String, dynamic> toJson() => _$FunConfigsBeanToJson(this);

}

@JsonSerializable(explicitToJson: true,includeIfNull: false)
class MenuBean {

  String? funName;
  String? funId;
  String? funCode;
  int isDisplay=0;

  List<MenuChildBean>? childrens;


  MenuBean(
      {this.funName, this.funId, this.funCode, this.isDisplay=0, this.childrens});

  factory MenuBean.fromJson(Map<String, dynamic> json) => _$MenuBeanFromJson(json);
  Map<String, dynamic> toJson() => _$MenuBeanToJson(this);

}
@JsonSerializable(explicitToJson: true,includeIfNull: false)
class Bean_login_guide {

  dynamic cashDefault;//收银 是否默认 1是 0否
  dynamic cancelDefault;//服务核销 是否默认 1是 0否
  dynamic rechargeDefault;//充值 是否默认 1是 0否

  Bean_login_guide({this.cashDefault, this.cancelDefault,
    this.rechargeDefault});


  factory Bean_login_guide.fromJson(Map<String, dynamic> json) => _$Bean_login_guideFromJson(json);
  Map<String, dynamic> toJson() => _$Bean_login_guideToJson(this);

}
@JsonSerializable(explicitToJson: true,includeIfNull: false)
class MenuChildBean {


  String? funName;
  String? funId;
  String? funCode;
  int isDisplay=0;
  int count=0; // 待处理订单数量

  String? jumpPageUrl; // Qbi使用
  bool isQbi=false; // Qbi使用
  bool isAdd=false;


  MenuChildBean({this.funName, this.funId, this.funCode, this.isDisplay=0,
    this.count=0, this.jumpPageUrl, this.isQbi=false, this.isAdd=false});

  factory MenuChildBean.fromJson(Map<String, dynamic> json) => _$MenuChildBeanFromJson(json);
  Map<String, dynamic> toJson() => _$MenuChildBeanToJson(this);

}